<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body>




<!--<script src="lib/three.js-r164/build/three.js"></script>-->
<!-- 具体路径配置，你根据自己文件目录设置，我的是课件中源码形式 -->
<script type="importmap">
    {
		"imports": {
			"three": "../lib/three.js-r164/build/three.module.js"
		}
	}
</script>

<script type="module">
    console.log("first.html  start...");
    // 导入如上目录
    import * as THREE from 'three';
    // 浏览器控制台测试，是否引入成功
    console.log("THREE 模块内容:", THREE);
    // import { LCCRender } from './lib/LCC-Web-0.5.0/lcc-0.5.0.js'
    import { LCCRender } from './lib/LCC-Web-0.4.1/lcc-0.4.1.js'
    console.log('LCCRender 模块内容:', LCCRender);

    const scene = new THREE.Scene();
    const camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 1000 );
    const renderer = new THREE.WebGLRenderer();
    console.log("准备开始执行渲染");



    // const dataPathResult = "http://localhost:3000/data/GCC/LCC_Results/GCC.lcc";
    const dataPathResult = "http://localhost:3000/data/GCC/OFFICE/LCC_Results/办公室最新.lcc";
    // const dataPathResult = "http://localhost:3000/data/LEGOPanda/meta.lcc";
    // const dataPathResult = "./data/LEGOPanda/meta.lcc";

    console.log("dataPathResult:",dataPathResult);

    const lccObject = LCCRender.load({
        camera:camera,
        scene:scene,
        dataPath:dataPathResult,
        renderLib:THREE,
        renderer: renderer,
        canvas:renderer.domElement,
        pointsColor:'default'//'default' or 'rainbow'
    },function(mesh){
        console.log("加载完成:",mesh);
    },function(percent){
        console.log("加载进度:"+ percent * 100 + "%");
    },function(){
        console.log("模型加载失败");
    });
    console.log("first.html  end...");

    function render() {
        console.log("更新场景...");// 模型动画
        // 更新场景
        LCCRender.update(); // 更新LCCRender
        renderer.render(scene, camera);
    }

    function animate() {
        console.log("animate...");// 模型动画
        requestAnimationFrame(() => {
            render();
        });
    }

    // 场景动画
    animate();


</script>

</body>

</html>